package com.example.jinyu;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class ResultActivity extends Activity implements OnItemClickListener{

	private ListView list;
	private ArrayAdapter<String> adapter;
	private List<String> list_str;
//	private int resultCode;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_result);
		list=(ListView) this.findViewById(R.id.listView1);
		list_str=new ArrayList<String>();
		list_str.add("233");
		list_str.add("23");
		list_str.add("33");
		adapter=new ArrayAdapter<String>(this, R.layout.item_str, R.id.item_tvstr, list_str);
		list.setAdapter(adapter);
//		resultCode=getIntent().getIntExtra("code", 0);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.result, menu);
		return true;
	}

	@Override
	public void onItemClick(AdapterView<?> parent, View view, int position,
			long id) {
		// TODO Auto-generated method stub
		Intent data=new Intent();
		data.putExtra("index", list_str.get(position));
		setResult(1001, data);
		finish();
	}
}
